#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    //创建菜单栏
    QMenuBar*menuBar =new QMenuBar();
    this->setMenuBar(menuBar);

    //创建菜单
    QMenu*num1= new QMenu("文件(&F)");
    QMenu*num2= new QMenu("编辑(&E)");
    QMenu*num3= new QMenu("视图(&v)");
    QMenu*num4= new QMenu("关于(&A)");
    menuBar->addMenu(num1);
    menuBar->addMenu(num2);
    menuBar->addMenu(num3);
    menuBar->addMenu(num4);

    //创建菜单项
    QAction*action1 = new QAction("菜单项1");
    QAction*action2 = new QAction("菜单项2");
    QAction*action3 = new QAction("菜单项3");
    QAction*action4 = new QAction("菜单项4");
    num1->addAction(action1);
    num2->addAction(action2);
    num3->addAction(action3);
    num4->addAction(action4);

    QAction* aci1= new QAction("子菜单");

}

MainWindow::~MainWindow()
{
    delete ui;
}

